<section class="message-add-reply">
    <?php echo $this->form_add; ?>
</section>
<div class="list">    
    <?php
    foreach ($this->messages as $message)
    {
    ?> 
        <div class="pm">
            <div class="pm_details">
                <span class="pm_details_from"><?php echo $message->Userfrom->Givenname . " " . $message->Userfrom->Familyname . " (#" . $message->Userfrom->Id . ")"; ?></span>
                <span class="pm_details_date"><?php echo $message->Senddate; ?></span>
            </div>
            <div class="pm_content">
                <span class="pm_content_subject"><?php echo $message->Subject?></span>
                <span class="pm_content_message"><?php echo $message->Content?></span>
            </div>
            <div class="pm_controls">
                <?php
                if($this->is_admin)
                {
                    $delete_url = $this->baseUrl()."/message/deletebyadmin/id/".$message->id."";
                ?>
                    <a href="<?php echo $delete_url; ?>">
                        <img src="<?php echo $this->baseUrl(); ?>/styles/assets/cross.png" />
                    </a>
                <?php
                }
                ?>
            </div>
        </div>
    <?php } ?>
</div>